<?php 
/**
	 * @todo 道具x详情 购买
	 * @author 任彦杰
	 */
	define('_VIEW_MODEL_','default');
	require_once("./init.php");
	$uid = isset($uid)?intval($uid):0;
	$pid = isset($pid)?intval($pid):0;
	if (isset($act) && $act == 'buy'){
		$num = isset($num)?intval($num):0;
		if($num <= 0)errorPrompt('number_no_fu','/'); //小说不存在
		if (empty($uid)){
			header("Location:login.php");exit;
		}
		
		//查询是否有购买记录
		$proplo = $db->GetRow("select id from {$telper}user_prop where userid = $uid and propid = $pid");
		if ($proplo['id']){//如果有记录
			$db->Execute("update {$telper}user_prop set num = num + $num where userid = $uid and propid = $pid");
		}else {//没有记录时
			$db->Execute("insert into {$telper}user_prop (`id`, `userid`, `propid`, `num`)  values (NULL, $uid, $pid, $num)");
		}
	}
	$rs = $db->Execute("select * from {$telper}prop where id = $pid");
	$propinfo = $rs ->GetArray();
	if ($propinfo){
		$propinfo = $propinfo[0];
	}
	header("Content-type:text/vnd.wap.wml;charset=utf-8");
	$smartyObj->assign('title',$adminproplist);
	$smartyObj->assign("propinfo",$propinfo);
	$smartyObj->assign("moneyname",$moneyname);
	$smartyObj->assign("uid",$uid);
	$smartyObj->display("props.tpl");
?>